﻿using vkUpploaderLib;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using vkUpploaderLib.Objects;
using System.Xml.Linq;
using System.Collections.Generic;

namespace VKUpploaderTests
{
    
    
    /// <summary>
    ///This is a test class for ApiHelperTest and is intended
    ///to contain all ApiHelperTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ApiHelperTest
    {


        /// <summary>
        ///A test for CreateNewAlbum
        ///</summary>
     //   [TestMethod()]
        public void CreateNewAlbumTest()
        {
            int viewPermission = 0; // TODO: Initialize to an appropriate value
            int commentPermission = 0; // TODO: Initialize to an appropriate value
            string name = string.Empty; // TODO: Initialize to an appropriate value
            Album expected = null; // TODO: Initialize to an appropriate value
            Album actual;
            actual = ApiHelper.CreateNewAlbum(viewPermission, commentPermission, name, null);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ExcecuteMethod
        ///</summary>
     //   [TestMethod()]
        public void ExcecuteMethodTest()
        {
            string method = string.Empty; // TODO: Initialize to an appropriate value
            ParametersCollection parameters = null; // TODO: Initialize to an appropriate value
            XDocument expected = null; // TODO: Initialize to an appropriate value
            XDocument actual;
            actual = ApiHelper.ExcecuteMethod(method, parameters);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetAlbum
        ///</summary>
     //   [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void GetAlbumTest()
        {
            XElement node = null; // TODO: Initialize to an appropriate value
            Album expected = null; // TODO: Initialize to an appropriate value
            Album actual;
            actual = ApiHelper_Accessor.GetAlbum(node);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetAlbums
        ///</summary>
    //    [TestMethod()]
        public void GetAlbumsTest()
        {
            List<Album> expected = null; // TODO: Initialize to an appropriate value
            List<Album> actual;
            actual = ApiHelper.GetAlbumsForUserOrGroup();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetAlbums
        ///</summary>
           [TestMethod()]
        public void GetGroupsTest()
        {
            List<Album> expected = null; // TODO: Initialize to an appropriate value
            AuthHelper.UserID = 7938601.ToString();
            AuthHelper.Auth();
            var actual = ApiHelper.GetGroups();
            Assert.AreEqual(3, actual.Count);
        }

        /// <summary>
        ///A test for GetOriginalUrl
        ///</summary>
        [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void GetOriginalUrlTest()
        {
            AuthHelper.Auth();
            //photo7938601_263904542
            string pid = "263908872";
            string expected = "http://cs11187.vkontakte.ru/u7938601/137732138/w_a0b245ea.jpg";
            string actual;
            actual = ApiHelper.GetOriginalUrl(pid, "137732138");
            Assert.AreEqual(expected, actual);
        }


        /// <summary>
        ///A test for GetOriginalUrlNotExistPVDownload
        ///</summary>
        [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void GetOriginalUrlTest_PvNotFound()
        {
            AuthHelper.Auth();
            //photo7938601_263904542
            string pid = "263935292";
            string expected = "http://cs11187.vkontakte.ru/u7938601/137732138/y_c83680dd.jpg";
            string actual;
            actual = ApiHelper_Accessor.GetOriginalUrl(pid, "137732138");
            Assert.AreEqual(expected, actual);
        }

        
        /// <summary>
        ///A test for GetPhotoDetails
        ///</summary>
     //   [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void GetPhotoDetailsTest()
        {
            string photoId = string.Empty; // TODO: Initialize to an appropriate value
            string albumId = string.Empty; // TODO: Initialize to an appropriate value
            Photo expected = null; // TODO: Initialize to an appropriate value
            Photo actual;
            actual = ApiHelper_Accessor.GetPhotoDetails(photoId, albumId);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetUploadUrl
        ///</summary>
     //   [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void GetUploadUrlTest()
        {
            AuthHelper.Auth();
            //photo7938601_263904542
            string pid = "263904542";
            string expected = "http://cs11187.vkontakte.ru/u7938601/-7/z_7d7a71bd.jpg"; 
            string actual;
            actual = ApiHelper_Accessor.GetUploadUrl(pid, null);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

      


        /// <summary>
        ///A test for ThrowIfError
        ///</summary>
     //   [TestMethod()]
        [DeploymentItem("vkUpploaderLib.dll")]
        public void ThrowIfErrorTest()
        {
            XElement root = null; // TODO: Initialize to an appropriate value
            ApiHelper_Accessor.ThrowIfError(root);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for UploadImage
        ///</summary>
   //     [TestMethod()]
        public void UploadImageTest()
        {
            string fileName = string.Empty; // TODO: Initialize to an appropriate value
            string albumId = string.Empty; // TODO: Initialize to an appropriate value
            Photo expected = null; // TODO: Initialize to an appropriate value
            Photo actual;
            actual = ApiHelper.UploadImage(fileName, albumId, null);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
